#!/bin/bash
main() {
    pushd zips
        for i in `ls *.zip`;do
            unzip $i
        done
    popd
    # config ohmyzsh
    config_ohmyzsh
  

    # config git
    config_git

    # config repo
    config_repo

    # config vim
    
}


config_ohmyzsh() {
    rm -rf .oh-my-zsh
    cp -r zips/ohmyzsh-master ~/.oh-my-zsh
    cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
    sed -i 's#ZSH_THEME="robbyrussell"#ZSH_THEME="ys"#' ~/.zshrc

    rm -rf ~/.zsh_self
    mkdir ~/.zsh_self
    cp configs/sh_self/*.sh ~/.zsh_self
    cat configs/enable_self_zsh.txt >> ~/.zshrc

    # 配置用户私有可执行文件目录
    mkdir -p ~/usr/bin
    ln -s ~/usr/bin ~/bin
    echo 'export PATH=~/usr/bin:$PATH' >> ~/.zshrc
}

config_repo() {
    # 安装repo
    curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
    chmod a+x ~/usr/bin/repo
    mv repo ~/usr/bin
}

config_git() {
    git config --global user.name 'mindulmindul'
    git config --global user.email 'mindul@qq.com'
    git config --global core.editor 'vim'
}



main